﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TalksLog.Domain.Core;
using TalksLog.Unities;
using Unity;

namespace TalksLog.Infrastructure.EventBus
{
    public class SimpleDomainEventsBus<T> : DomainEventsBusBase<T> where T:DomainEventBase
    {
        public override void Raise(T domainEvent)
        {
            var handlers = IocContainer.DefaultContainer.ResolveAll<IDomainEventHandle<T>>();
            foreach (var item in handlers)
            {
                item.Handle(domainEvent);
            }
        }
    }
}
